{aide_template 'common/header'}
<link href="{$aideUrl}web/resource/css/util.min.css" rel="stylesheet">
<script type="text/javascript" src="{$aideUrl}web/resource/js/util.min.js?v=20170912"></script>
<style>
    .label-default{background-color:#d1dade;color:#5e5e5e;}
    .input-group-addon .radio-inline, .input-group-addon .checkbox-inline{padding-top:0; line-height:0.95;}
    .dropdown-menu{ min-width:145px; }
    .multi-img-details .multi-item{height:auto;}
    #member.multi-img-details .multi-item{text-align:center; max-width:100px;}
    #member.multi-img-details .multi-item img{ max-width:90px; max-height:90px;}
    #member.multi-img-details .multi-item .title{ overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}
    #myTab2.nav-tabs{border-color: #1ab394;}
    #myTab2.nav-tabs>li>a{border-radius:0!important;padding: 7px 15px;}
    #myTab2.nav-tabs>li>a:hover{ color:#333}
    #myTab2.nav-tabs>li.active>a, #myTab2.nav-tabs>li.active>a:hover, #myTab2.nav-tabs>li.active>a:focus{color: #FFF;border-radius:0;background-color: #1ab394;border-color: #1ab394;}
    #options.markethide .optmarket, .markethide.market{display:none}
</style>
<link href="{$_W['siteroot']}web/resource/components/select2/select2.min.css" rel="stylesheet">
{if $op == 'display'}
<ol class="breadcrumb we7-breadcrumb" style="display:none">
    <a href="./index.php?c=site&amp;a=article&amp;"><i class="wi wi-back-circle"></i> </a>
    <li><a href="./index.php?c=site&amp;a=article&amp;">合作注册</a></li>
</ol>
<ul class="nav nav-tabs" id="myTab">
    <li class="active"><a href="#tab_basic">注册列表</a></li>
</ul>

<form class="form-horizontal" action="" method="post">
    <div class="panel panel-default">
        <div class="table-responsive">
            <table class="table table-hover table-bordered">
                <thead class="navbar-inner">
                <tr>
                    <th class="text-center" style="width:40px;">
                        <input type="checkbox" name="checkall" value="" id="checkall" onClick="var ck = this.checked; $(':checkbox').each(function(){this.checked = ck});">
                    </th>
                    <th class="text-left">是否通过？</th>
                    <th class="text-center" style="width:40px;">ID</th>
                    <th class="text-left">注册人姓名</th>
                    <th class="text-left">注册人联系电话</th>
                    <th class="text-left">注册人身份证正反面</th>
                    <th class="text-left">常住城市</th>
                    <th class="text-left">样片</th>
                    <th class="text-left">注册时间</th>
                    <th class="text-center">操作</th>
                </tr>
                </thead>
                <tbody style="text-align: center;">
                {loop $recruit $item}
                <tr>
                    <td class="text-center"><input type="checkbox" name="check" value="{$item['id']}" class="items"></td>
                    <td class="text-left">
                        <label class="radio radio-inline">
                            <input type="radio" name="recruit{$item['id']}[is_pass]" data-id="{$item['id']}" value="0" {if $item['is_pass']==0} checked{/if}> 未审核
                        </label><br>
                        <label class="radio radio-inline">
                            <input type="radio" name="recruit{$item['id']}[is_pass]" data-id="{$item['id']}" value="1" {if $item['is_pass']==1} checked{/if}> 审核通过
                        </label><br>
                        <label class="radio radio-inline">
                            <input type="radio" name="recruit{$item['id']}[is_pass]" data-id="{$item['id']}" value="2" {if $item['is_pass']==2} checked{/if}> 审核不通过
                        </label><br>
                        意见：<input type="text" name="reason" value="{$item['reason']}" >
                    </td>
                    <td>{$item['id']}</td>
                    <td class="text-left">{$item['name']}
                    </td>
                    <td class="text-left">{$item['mobile']}</td>
                    <td class="text-left">
                        <img src="{php echo tomedia($item['positive'])}" width="100px">
                        <img src="{php echo tomedia($item['reverse'])}" width="100px">
                    </td>
                    <td class="text-left">{$item['city']}</td>
                    <td class="text-left">
                        {loop  explode(",",$item['picnum']) $val}
                        <img src="{php echo tomedia($val)}" width="100px" height="75px">
                        {/loop}
                    </td>
                    <td class="text-left">{$item['updated_at']}</td>
                    <td class="text-center">
                        <div class="btn-group">
                            <a href="{php echo web_url('recruit/recruit/post', array('recruitid' => $item['id']))}" class="btn btn-success btn-sm">详情</a>
                            <a href="javascript:void(0);" class="js-delete btn btn-danger btn-sm" data-id="{$item['id']}">删除</a>
                        </div>
                    </td>
                </tr>
                <script>
                    //微擎1.0+显示switch

                    $("input[name='recruit{$item['id']}[is_pass]']").click(function(e){
                        var id = $(this).data('id');
                        var state=$(this).val();
                        var reason=$("input[name='reason']").val();
                        $.getJSON("{php echo web_url('recruit/recruit/pass')}", {id:id, state:state,reason:reason}, function(res) {
                            util.tips('修改成功');
                        });

                    });
                    </script>
                {/loop}
                </tbody>
            </table>
        </div>
    </div>
    <div class="pull-right">{$pager}</div>
</form>
<script>
    //删除效果b，单条操作
    $('.js-delete').click(function(e) {
        e.stopPropagation();
        var $this = $(this);
        var recruitid = $this.data('id');
        util.nailConfirm(this, function(state) {
            if (!state) return;
            $.post("{php echo web_url('recruit/recruit/delete')}", {recruitid : recruitid}, function(data) {
                if(!data.errno){
                    $this.parents('tr').remove();
                }
                util.tips(data.message);
            }, 'json');
        }, {html:"确定删除？",placement: $this.data('placement')});
    });
    function setProperty(obj,id){
        $(obj).html($(obj).html() + "...");
        $.post("{php echo web_url('recruit/recruit/pass')}",{id:id, data: obj.getAttribute("data")},function(d){
                $(obj).html( d.data=='1'?'未审核':'审核通过');
                $(obj).attr("data",d.data);
                if (d.result==1){
                    util.tips('修改成功');
                    if(d.data==1){
                        $(obj).removeClass("label-success");
                        $(obj).toggleClass("label-default");
                    }else {
                        $(obj).toggleClass("label-success");
                        $(obj).removeClass("label-default");
                    }
                }else {
                    util.tips('修改失败');
                }

            }
            ,"json"
        );
    }
</script>
{elseif $op == 'post'}
<ol class="breadcrumb we7-breadcrumb" style="display:none">
    <a href="./index.php?c=site&amp;a=article&amp;"><i class="wi wi-back-circle"></i> </a>
    <li><a href="./index.php?c=site&amp;a=article&amp;">注册详情</a></li>
</ol>
<ul class="nav nav-tabs" id="myTab">
    <li class="active"><a href="#tab_basic">注册详情</a></li>
</ul>

<div class="main">
    <form action="" method="post" onsubmit="return check(this)" class="form-horizontal form" enctype="multipart/form-data">
        <input type="hidden" name="recruitid" value="{$recruitid}"/>
        <div class="tab-content" style="height: 500px">
            <div class="tab-pane in active" id="tab_basic">
                <div class="panel panel-default">
                    <div class="panel-heading">基本信息</div>
                    <div class="panel-body">
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">注册人姓名</label>
                            <div class="col-sm-6 col-xs-12">
                                <input type="text" name="recruit[name]" class="form-control" value="{$recruit['name']}" placeholder="活动名称"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">注册人昵称</label>
                            <div class="col-sm-6 col-xs-12">
                                <input type="text" name="recruit[nickname]" class="form-control" value="{$recruit['nickname']}" placeholder="活动名称"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">注册人联系电话</label>
                            <div class="col-sm-6 col-xs-12">
                                <input type="text" name="recruit[mobile]" class="form-control" value="{$recruit['mobile']}" placeholder="活动名称"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">身份证正反面</label>
                            <div class="col-md-6 col-xs-12">
                                <img src="{php echo tomedia($recruit['positive'])}" width="200px" height="150px">
                                <img src="{php echo tomedia($recruit['reverse'])}" width="200px" height="150px">
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">邮箱</label>
                            <div class="col-sm-6 col-xs-12">
                                <input type="text" name="recruit[email]" class="form-control" value="{$recruit['email']}" placeholder="活动名称"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">常住城市</label>
                            <div class="col-sm-6 col-xs-12">
                                <input type="text" name="recruit[city]" class="form-control" value="{$recruit['city']}" placeholder="活动名称"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">擅长拍摄项目</label>
                            <div class="col-sm-6 col-xs-12">
                                <input type="text" name="recruit[pro]" class="form-control" value="{$recruit['pro']}" placeholder="活动名称"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">相机型号</label>
                            <div class="col-sm-6 col-xs-12">
                                <input type="text" name="recruit[camera]" class="form-control" value="{$recruit['camera']}" placeholder="活动名称"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">镜片型号</label>
                            <div class="col-sm-6 col-xs-12">
                                <input type="text" name="recruit[lens]" class="form-control" value="{$recruit['lens']}" placeholder="活动名称"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">拍摄经历</label>
                            <div class="col-sm-6 col-xs-12">
                                <textarea type="text" name="recruit[experience]" class="form-control" style="height: 100px;"  placeholder="活动名称">{$recruit['experience']}</textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">样片</label>
                            <div class="col-md-6 col-xs-12">
                                {loop $recruit['picnum'] $val}
                                <img src="{php echo tomedia($val)}" width="200px" height="150px">
                                {/loop}
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">审核设置</label>
                            <div class="col-xs-12 col-sm-5">
                                <label class="radio radio-inline">
                                    <input type="radio" name="recruit[is_pass]" value="1"{if $recruit['is_pass']} checked{/if}> 审核通过
                                </label>
                                <label class="radio radio-inline">
                                    <input type="radio" name="recruit[is_pass]" value="0"{if !$recruit['is_pass']} checked{/if}> 未审核
                                </label>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="form-group" style="text-align:center;">
            <div class="col-xs-12">
                <input name="submit" type="submit" value="　　保存　　" class="btn btn-primary"/>
                <input type="hidden" name="token" value="{$_W['token']}"/>
            </div>
        </div>
    </form>
</div>
{/if}
{aide_template 'common/footer'}
